magiclanternfandomcom-20200223-history
2.0.4 Building ML
Parent: 2.0.4 AJ . DONT USE THIS PAGE TO BUILD YOUR ENVIRONMENT. THIS PAGE IT IS WORK-IN-PROGRESS AS I TRY FOLLOW THE MAIN ML BUILD METHODOLOGY IT DOCUMENTS ALL THE STEPS I'M TAKING - AND CONFUSION ALONG THE WAY. IT ASSUMES THAT NOTHING IS INSTALLED (WHICH IS CLOSE TO THE TRUTH) WHEN I FIND TERM / SOFTWARE I'VE NEVER USED, I DEFINE WHAT THAT SOFTWARE DOES AT A HIGH LEVEL. AT THE END OF THIS (ASSUMING I SUCCEEED), I'LL DELETE THE 'RUBBISH' OF WRONG TURNS, MISTAKES ... SO THAT YOU TOO CAN SETUP A BUILD ENVIRONMENT :) --> Special thanks to AI + Alex who are giving me 'beginners' tips on setting up the Environment! My intention is to Build n Test ML based on Canon firmware 2.0.4 / 5Dii. [2010_10_25] My initial attempt in 2010_03 failed on Mac OS X / SnowLeopard. AI's success in porting ML to the 550D has given me hope that I'll succeed this time around. AJ's Hardware *Mac Pro (2 x Quad Core) / OS X SnowLeopard 10.6.4 *Canon 5d II @ Dry OS 2.0.4 *Kinston 32GB 133X CCF Build instructions that I going to work through *http://magiclantern.wikia.com/wiki/Build_instructions -> This is the main build page instructions I'll call BP. *http://magiclantern.wikia.com/wiki/Build_instructions/550D -> This is the 550D branch of the instructions in which AI & Alex (and others!) have succeeded in buiding the 550D. [BP550] Activity (Yes - this is all new to me; I'm a complete novice in this area!) STEP 0.0 - MERCURIAL (Source Code Repositor'y) *From 'BP page: *AJ Mercurial is a distributed Source Code Management Downloaded 1.6.3 from http://mercurial.selenic.com/wiki/Download -> Installed AJ According to http://mercurial.selenic.com/wiki/TutorialInstall hg now activates Mercurial binaries *Run Applications->Utilities->Termnal (Unix Prompt) *hg version -> should show version 1.6.3 is installed *AJ The Clone command syncronises the Mercurial Repository with the one on your machine hg clone https://bitbucket.org/hudson/magic-lantern/ -> added 562 changesets with 1185 changes to 158 files-> 146 files updated *AJ If theres remnants of previous directory -> Rename / delete magic-lantern folder from the Finder. STEP 0.1 - Install XCODE & X11 ''' *If you already have an old copy of Xcode on your Mac. Uninstall it, and reinstall from scratch. This should increase the stability of Xcode. *Use Mac OS X Snow Leopard install disc to install '''Xcode -> Optional Installs.mpkg -> Xcode.mpkg -> -> Ticked everything ... including Max OS X 10.4 Support -> Install -> Done *Use Mac OS X Snow Leopard install disc to install''' X11''' -> Optional Installs.mpkg -> Applications -> Tick X11 -> Install -> Done *Checked for software updates: Apple -> Software Update "Xcode" 592.2 MB software patch now downloading. Install -> Done *Checked for software updates again : Apple -> Software Update Nothing else to install *Reboot your machine - an Apple recommendation. STEP 0.2 - Install of MacPorts 1.9.1 *'MacPorts' is a provides an easy tool for installing and upgrading software titles (ie 'Port'ing software to a Mac): http://www.macports.org/ Downloaded Macports 1.9.1 (for SnowLeopard) (MacPorts requires that Xcode and X11 are installed before it will install - Done in Step 0.1) *Installed MacPorts 1.9.1 -> Done STEP 0.3 - Using MacPorts to Install things (needed for ToolChain actions to succeed later on) *Should be "install gmp, mpfr, libmpc, libiconv and wget packages using MacPorts." *This is done by starting the 'Terminal' window and performing a single command: sudo port install gmp mpfr libmpc libiconv wget *If the above (all-in-one command) is failing - you can it can do this one install at the time using the following commands to help understand which is causing problems (eg if you don't want to wade through you Terminal logs): sudo port install gmp sudo port install mpfr sudo port install libmpc sudo port install libiconv sudo port install wget sudo port install autoconf <- I don't think autoconf was required - but I've listed it here just in case *I used the all-in-one command: macintosh:~ jfdi$ sudo port install gmp mpfr libmpc libiconv wget ---> Computing dependencies for''' gmp''' ................ Cleaning wget Done ''' --> '''HUGE thanks to Alex for geting me on the right track for this!! <-'''-''' STEP 0.4 - Change Snow Leopard 'tar' back to gnu tar. ' After a few failed attempts with 'tar' (decompressing) commands - I found this: http://macitbetter.com/node/354 The problem is that Apple used to include the GNU version of tar at /usr/bin/tar. With Snow Leopard Apple changed /usr/bin/tar to point to bsdtar, breaking any scripts or applications that depended on gnutar To change it type the following in terminal: *'cd /usr/bin; sudo ln -fs gnutar tar && /usr/bin/tar --version To verify, it should say GNU somewhere in the output. To change it back to default: (only needed after we have succeeded in getting the Summon-tool-chain to work btw) *To revert the earlier command (ie not now!) cd /usr/bin; sudo ln -fs bsdtar tar && /usr/bin/tar --version ''' '''Done STEP 1 - SUMMON-ARM-TOOLCHAIN a) Download the summon-arm-toolchain script ''' b) (by Uwe Hermann, c) github repo here) d) edit it as follows: TARGET=arm-elf PREFIX=${HOME}/arm-toolchain # Install location of your final toolchain PARALLEL="-j 9" # Or: PARALLEL="-j 5" for 4 cores, "-j 9" for 2 Quad Cores etc. Or just ignore it. DARWIN_OPT_PATH=/opt/local # Path in which MacPorts or Fink is installed BINUTILS=binutils-2.19.1 GCC=gcc-4.3.2 NEWLIB=newlib-1.17.0 GDB=gdb-7.1 tar xf${TARFLAGS} ${SOURCES}/$1.tar.* # changed from '''xaf as "a'''" option not allowed in gnutar on Snowleopard *Before we start, we need to create a Unix file. This will enable us to edit in TextEdit (and avoid using the '''vi editor ) Open Terminal. In home UNIX directory - create a Unix file using: echo "test" > summon-arm-toolchain.sh *a) Open URL -> Select all -> Paste into TextEdit of summon-arm-toolchain.sh -> Save (ie back to Unix home directory) *b) ignore this page - it's out of date *c) this explains the compilation steps that much be completed using MacPorts. These actions are listed above in Steps 0.3 *d) Make the changes in TextEdit -> Save (ie back to Unix home directory) Done Step 2. '''Get the dependencies .... *All these steps were done in Steps 0.3 '''Done Step 3. 'Run the script (it will take a long time): bash summon-arm-toolchain This will install arm-elf-gcc under ~/arm-toolchain/bin. Note: In this section, you may need to rerun the toolchain stript (eg if a download gets stuck). Rerunning uses a (time) stamps directory in you UNIX home directory to determine where the script got to last time. If you do want to rerun this process from scratch -> open Finder -> got to UNIX home directory / sources -> Delete stamps, sources, build directory and then -> rerun summon-arm-toolchain scipt again. *Run Terminal. *'bash summon-arm-toolchain.sh sec Downloading binutils-2.19.1 sources min 2 sec Downloading gcc-4.3.2 sources sec Downloading newlib-1.17.0 sources sec Downloading gdb-7.1 sources Unpacking binutils-2.19.1 -> Configuring binutils-2.19.1 -> Building binutils-2.19.1 -> Cleaning Up -> Done Unpacking gcc-4.3.2 boot -> Configuring gcc-4.3.2 -boot -> Building gcc-4.3.2-boot -> Done Unpacking newlib-1.17.0 sources -> Configuring newlib-1.17.0 sources -> Building newlib-1.17.0 -> Cleaning Up -> Done Unpacking gcc-4.3.2 -> Configuring gcc-4.3.2 -> Building gcc-4.3.2 -> FAILURE * CURRENTLY HERE - THIS CURRENLTY FAILING *Last lines of summon script output: gcc -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -o cc1plus-dummy cp/cp-lang.o stub-objc.o cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o cp/ptree.o cp/rtti.o cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o cp/optimize.o cp/mangle.o cp/cp-objcp-common.o cp/name-lookup.o cp/cxx-pretty-print.o cp/cp-gimplify.o tree-mudflap.o attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o c-dump.o arm-c.o c-pretty-print.o c-opts.o c-pch.o c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o c-gimplify.o c-omp.o tree-inline.o dummy-checksum.o main.o libbackend.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcpp/libcpp.a -L/opt/local/lib -liconv ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/opt/local/lib -L/opt/local/lib -lmpfr -lgmp ld: duplicate symbol _init_inline_once in libbackend.a(tree-inline.o) and tree-inline.o collect2: ld returned 1 exit status make2: *** cc1plus-dummy Error 1 make2: *** Waiting for unfinished jobs.... make1: *** all-gcc Error 2 make: *** all Error 2 *Seems like other people have seen the same sort of error: http://old.nabble.com/gcc43-4.3.0-1000-failed-compiling-td16040370.html *'https://trac.macports.org/ticket/20816' Trying the following: (1) sudo port install libiconv +universal (2) sudo port install mpfr +universal http://chdk.wikia.com/wiki/Compiling_CHDK_under_Mac_OS_X haven't got to the following line yet: Unpacking Downloading gdb-7.1 sources -> Configuring Downloading gdb-7.1 sources 'Step 4. '''Test the installation by compiling a Hello World program: hello.c #include #include int main() { int x; x = 5; } ~/arm-toolchain/bin/arm-elf-gcc -c hello.c You should get a file named ''hello.o . When compiling without "-c", it may complain about missing _exit and _sbrk, but this is OK according to this forum post. macintosh:~ jfdi$ vi hello.c macintosh:~ jfdi$ ~/arm-toolchain/bin/arm-elf-gcc -c hello.c